package net.xdclass.xdclass_shiro.dao;

import net.xdclass.xdclass_shiro.domain.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 权限操作
 *
 * @author zhangsj
 * @date 2020/5/2 10:03
 */
public interface PermissonMapper {

    /**
     * 查询角色对应的权限列表
     *
     * @param roleId 角色id
     * @return {@link Permission}
     */
    @Select("select xp.id, xp.name, xp.url\n" +
            "from xd_role_permission xrp\n" +
            "left join xd_permission xp on xp.id = xrp.permission_id\n" +
            "where xrp.role_id = #{roleId}")
    List<Permission> findListByRoleId(@Param("roleId") String roleId);
}
